#!/bin/bash

notarget ()
{
   echo 'Running default release..';
   mono OR.Lazarus.Presentation/bin/Debug/OR.Lazarus.Presentation.exe
}

noreleases ()
{
  echo 'No releases found.';
}

if [ ! $1 ]; then
  notarget
fi

release_parent='./releases'

if [ ! -d $release_parent ]; then
   mkdir releases
fi

release_folder=$release_parent/$1

if [ ! -d $release_folder ]; then
  noreleases
else
  mono $release_folder/lazarus.exe
fi

echo 'Release '$1' Executed.'

exit 0
